<?php
	$this->breadcrumbs = $breadcrumbs;
	$this->menu = $menu;
	$this->pageTitle=Yii::app()->name . ' - ' . $section->name;
?>

<div class="section-content">
	<!--
	<h1><?php echo $section->name; ?></h1>
	-->
	
	<div class="section-post">
	<?php if( !empty($items) ):?>
		
		<?php $cnt=0; ?>
		<?php foreach ($items as $item):?>
		
			<?php if( $cnt % 3 == 0 ): ?>
			<div class="section-post-wrap">
			<?php endif; ?>

				<div class="section-post-firm">
					<a href="?r=site/view&id_section=<?php echo $item->id_section; ?>&id=<?php echo $item->id; ?>"><img src="uploads/<?php echo $item->icon->file_name; ?>" alt="<?php echo $item->icon->alt; ?>"/></a><br />
					<a href="?r=site/view&id_section=<?php echo $item->id_section; ?>&id=<?php echo $item->id; ?>"><?php echo $item->title; ?></a>
				</div>

			<?php if( $cnt % 3 == 2 ): ?>
			<div class="clear"></div>
			</div>
			<?php endif; ?>

			<?php $cnt++; ?>
		<?php endforeach; ?>

		<?php $cnt--; ?>
		<?php if( ($cnt--) % 3 != 2 ): ?>
		<div class="clear"></div>
		</div>
		<?php endif; ?>

	<?php endif; ?>
	</div>

	<?php if( $pages > 1 ): ?>
	<div class="section-pagination">
		<!-- prev -->
		<?php if( $page != 1 ): ?>
			<span>
				<a href="?r=site/view&id_section=<?php echo $item->id_section; ?>&st=<?php echo ($page-2)*$perpage; ?>">&laquo; назад</a>
			</span>
		<?php endif; ?>

		<?php for ($i = 1; $i <= $pages; $i++): ?>
			<span>
			<?php if( $page != $i ): ?>
				<a href="?r=site/view&id_section=<?php echo $item->id_section; ?>&st=<?php echo ($i-1)*$perpage; ?>"><?php echo $i; ?></a>
			<?php else: ?>
				<?php echo $i; ?>
			<?php endif; ?>
			</span>
		<?php endfor; ?>

		<!-- next -->
		<?php if( $page != $pages ): ?>
			<span>
				<a href="?r=site/view&id_section=<?php echo $item->id_section; ?>&st=<?php echo $page*$perpage; ?>">далее &raquo;</a>
			</span>
		<?php endif; ?>
	</div>
	<?php endif; ?>
	
</div>
